!pr1
Put Your Messages on the Screen..............William M. Reed

COUT is slow.  COUT with DOS looking on is even slower.  And I suppose with ProDOS, more so.  If you want to get a short message on the screen in a hurry, you can bypass COUT and put it there directly.

In all of the following examples I am going to assume that the message is stored in RAM exactly as it should be on screen, and that after the last character is a byte with $00 in it.  I also assume that you are only writing one line, so that the message will not spill over to another line.

Here is a loop that writes a message on the bottom line of the screen:

MESSAGE
       LDY #0
.1     LDA MESSAGE,Y
       BEQ .2          ...END OF MESSAGE
       STA $7D0,Y
       INY
       BNE .1          ...ALWAYS
.2     RTS

If you want to write on the current line, whose base address is kept by the monitor in BASL and BASH ($28 and $29), just change the STA $7D0,Y line to STA (BASL),Y.

All well and good for 40 columns, but what about the 80-column //e and //c screens?  Well, you can still do it, like this:

MESSAGE.80
       LDX #0       MESSAGE INDEX
.1     TXA
       LSR          COLUMN/2, ODD/EVEN TO CARRY
       TAY          INDEX INTO SCREEN MEMORY
       LDA MESSAGE,X
       BEQ .3       ...END OF MESSAGE
       STA PAGE1
       BCS .2       ...ODD, PAGE 1
       STA PAGE2    ...EVEN, PAGE 2
.2     STA (BASL),Y
       INX
       BNE .1       ...ALWAYS
.3     RTS
PAGE1  .EQ $C054
PAGE2  .EQ $C055

Of course, these routines put the messages on the screen only.  But that may be just what you want, to put messages on the screen without affecting the report going out to file or printer.  Also, these routines do not handle CR, end of line, scroll, etc; but they sure get to the screen in a hurry!

